"use strict";

module.exports = {
    // 在执行数据库升级时调用的函数，创建 t_users 表
    up: async (queryInterface, Sequelize) => {
        const { CHAR, DATE, STRING, UUID, UUIDV4 } = Sequelize;
        await queryInterface.createTable("t_dic", {
            id: {type: UUID, primaryKey: true, allowNull: false, defaultValue: UUIDV4},
            table_name: { type: STRING(50), primaryKey: true, allowNull: false },
            col_name: { type: STRING(50), primaryKey: true, allowNull: false },
            key: { type: STRING(50), primaryKey: true, allowNull: false },
            value: { type: STRING(50), primaryKey: true, allowNull: false },
            create_user_id: { type: UUID, allowNull: true },
            modify_user_id: { type: UUID, allowNull: true },
            create_time: { type: DATE, allowNull: false},
            modify_time: { type: DATE, allowNull: false}
        });
    },
    // 在执行数据库降级时调用的函数，删除 t_users1 表
    down: async queryInterface => {
        await queryInterface.dropTable("t_dic");
    }
};
